<?php

namespace App\Http\Controllers\Home;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use EasyWeChat\Foundation\Application;
class MenuController extends Controller
{   
    public $menu;
    
    
    public function __construct(Application $app) {
        $this->menu = $app->menu;
    }
    
    public function menu(){
        $buttons = [
            [
                "type" => "view",
                "name" => "EAI交易圈",
                "url"  => "http://m.eaifx.com/"
            ],
            [
                "type" => "view",
                "name" => "更多活动",
                "url"  => "http://m.eaifx.com/active"
            ],
            [
                "type" => "click",
                "name" => "赞一下",
                "key"  => "YOU_VOUTE_ME"
            ],
            
            
//            [
//                "name"       => "菜单",
//                "sub_button" => [
//                    [
//                        "type" => "view",
//                        "name" => "搜索",
//                        "url"  => "http://www.soso.com/"
//                    ],
//                    [
//                        "type" => "view",
//                        "name" => "视频",
//                        "url"  => "http://v.qq.com/"
//                    ],
//                    [
//                        "type" => "click",
//                        "name" => "赞一下我们",
//                        "key" => "V1001_GOOD"
//                    ],
//                ],
//            ],
        ];
        $this->menu->add($buttons);
    }
    
    public function getAllMenu(){
        $menus = $this->menu->current();
        return $menus;
    }
    
    public function delMenu(){
        $this->menu->destroy(); // 全部
        //$this->menu->destroy($menuId);
    }
}
